package com.bosssoft.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.bosssoft.entity.po.FibRolePO;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * @author Li kexi
 * Created on 2021/8/16.14:32
 */
public interface FibRoleMapper extends BaseMapper<FibRolePO> {

    /**
     * 通过id禁用角色
     * @param roleId
     * @return
     */
    @Update("UPDATE fib_role \n" +
            "SET deleted = #{status} \n" +
            "WHERE role_id = #{roleId}")
    int banRoleById(Long roleId, Integer status);


    int updateBatch(List<FibRolePO> list);

    int updateBatchSelective(List<FibRolePO> list);

    int batchInsert(@Param("list") List<FibRolePO> list);

    int insertOrUpdate(FibRolePO record);

    int insertOrUpdateSelective(FibRolePO record);

    //以下方法仅供测试用

    @Select("SELECT * \n" +
            "FROM fib_role")
    List<FibRolePO> getAllRoles();
}